package com.novartis.nims.trialsubmitter;

import javax.swing.SwingUtilities;

import com.novartis.nims.trialsubmitter.views.AdvancedView;
import com.novartis.nims.trialsubmitter.views.BasicView;
import com.novartis.nims.trialsubmitter.views.SwingView;

public class Application {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		//load application configuration
		try {
			final ApplicationConfiguration config = new ApplicationConfiguration();
			
			SwingUtilities.invokeLater(new Runnable() {
				public void run() {
					SwingView view = config.getAdvancedInterface() ? new AdvancedView(config) : new BasicView(config);
					ApplicationController controller = new ApplicationController(view, config);
					view.setController(controller);
					
					view.getJFrame().setVisible(true);
				}
			});
		} catch (ApplicationConfigurationException e) {
			System.out.println(e.getMessage());
			System.exit(1);
		}
	}

}
